home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / shell / csh535src.lha / shell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-10  |  6.8 KB  |  281 lines

  1. /*
  2.  * SHELL.H
  3.  *
  4.  * (c)1986 Matthew Dillon     9 October 1986
  5.  *
  6.  *
  7.  * SHELL include file.. contains shell parameters and extern's
  8.  *
  9.  * Version 2.07M by Steve Drew 10-Sep-87
  10.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  11.  * Version 5.00L by Urban Mueller 16-Mar-91
  12.  *
  13.  */
  14.  
  15. #define RAW_CONSOLE 1   /* Set to 0 to compile out command line editing */
  16.  
  17. /* uncommented by AMK for SAS/C 6.1 */
  18. /* #define strlen strlen */
  19.  
  20. #ifdef _DCC
  21. # define C_Args
  22. # define FUNCARG(x,y,z) ()
  23. #else
  24. # define FUNCARG(x,y,z) (x,y,z)
  25. # define KICK20
  26. #endif
  27.  
  28.  
  29. /* AMK: more includes for OS 2.0 */
  30.  
  31. #include <exec/types.h>
  32. #include <exec/exec.h>
  33. #include <exec/memory.h>
  34. #include <graphics/gfxbase.h>
  35. #include <graphics/text.h>
  36. #include <intuition/intuitionbase.h>
  37. #include <libraries/dos.h>
  38. #include <libraries/dosextens.h>
  39. #include <libraries/gadtools.h>
  40. #include <libraries/asl.h>
  41. #include <time.h>
  42. #include <ctype.h>
  43. #include <fcntl.h>
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <math.h>
  48. #include <dos/datetime.h>
  49. #include <dos/dosextens.h>
  50. #include <dos/dostags.h>
  51. #include <dos/var.h>
  52. #include <utility/tagitem.h>
  53. #include <resources/battclock.h>
  54.  
  55.  
  56. LONG AllocPattern    (STRPTR, ULONG);
  57. LONG MatchThePattern (LONG, STRPTR);
  58. void FreePattern     (LONG);
  59.  
  60.  
  61. typedef struct FileInfoBlock FIB;
  62.  
  63. #ifdef AZTEC_C
  64. # include <functions.h>
  65. # define DEVTAB(x)    (BPTR)(_devtab[x->_unit].fd)
  66. # define CHARSWAIT(x) (x->_bp < x->_bend)
  67. # define RESETIO(x)   (x->_bp = x->_bend)
  68. # define COMPILER "Aztec C 5.0d"
  69. # pragma amicall(PatternBase, 0x48, AllocPattern(a0,d0))
  70. # pragma amicall(PatternBase, 0x60, MatchThePattern(d0,a0))
  71. # pragma amicall(PatternBase, 0x66, FreePattern(d0))
  72. #endif
  73.  
  74. #ifdef LATTICE
  75. # include <proto/all.h>
  76. # include <ios1.h>
  77. /* # define DEVTAB(x)    _ufbs[(x)->_file].ufbfh*/
  78. # define DEVTAB(x)    __ufbs[(x)->_file].ufbfh
  79. # define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
  80. # define RESETIO(x)   (x->_rcnt =  x->_wcnt)
  81.  
  82.   /* AMK: already defined in <ios1.h>, extern struct UFB _ufbs[];*/
  83. # ifndef memmove
  84. # define memmove(t,f,l) movmem((f),(t),(l))
  85. # endif
  86. # define COMPILER "SAS/C 6"
  87. # define swapmem(x,y,z) swmem(x,y,z)
  88. # pragma libcall PatternBase AllocPattern 48 0802
  89. # pragma libcall PatternBase MatchThePattern 60 8002
  90. # pragma libcall PatternBase FreePattern 66 001
  91. #endif
  92.  
  93. #ifdef _DCC
  94. # define COMPILER "DICE 2.06"
  95. # define DEVTAB(x)    (_IoFD[x->sd_Fd].fd_Fh)
  96. # define CHARSWAIT(x) (x->sd_RPtr != x->sd_RBuf)
  97. # define RESETIO(x)   (x->sd_RPtr =  x->sd_RBuf)
  98. # define index strchr
  99. # define rindex strrchr
  100.   void * AllocMem(long byteSize, long requirements);
  101.   struct MsgPort *FindPort( UBYTE *name );
  102. #endif
  103.  
  104. #undef  toupper
  105. #define toupper(c)    ((c)>='a'&&(c)<='z'?((c)-('a'-'A')):(c))
  106.  
  107. #ifndef MAX
  108. #define MAX(x,y) ((x)>(y) ? (x) : (y))
  109. #endif
  110.  
  111. #define OPT(x) (options & (x))
  112.  
  113. #define MAXSRC        5        /* Max. # of source file levels    */
  114. #define MAXIF        20        /* Max. # of if levels            */
  115. #define MAXALIAS    20        /* Max. # of alias levels        */
  116. #define MAXMYFILES    9        /* Max. # of internal files        */
  117. #define MAXHASH        32        /* Max. # of hash chains        */
  118. #define MAXFILENAME    30
  119.  
  120. #define LEVEL_SET        0        /* which variable list to use   */
  121. #define LEVEL_ALIAS        1
  122. #define LEVEL_LABEL        2
  123. #define LEVEL_LOCAL        256
  124.  
  125. #define SBYTE signed char
  126. #define MAXMENUS    31    /* GadTools maximum */
  127. #define MAXMENUITEMS    63    /* GadTools maximum */
  128.  
  129. #define VERBOSE_SOURCE 1
  130. #define VERBOSE_ALIAS  2
  131. #define VERBOSE_HILITE 4
  132.  
  133. #define SCAN_FILE     1
  134. #define SCAN_DIR      2
  135. #define SCAN_RECURSE  4
  136. #define SCAN_DIRENTRY 8
  137. #define SCAN_DIREND   16
  138.  
  139. #ifndef NULL
  140. #define NULL 0L
  141. #endif
  142.  
  143. #define CHECKBREAK() dobreak()
  144. #define ISSPACE(c) ((c)==' ' || (c)==9 || (UBYTE)(c)==0xA0)
  145.  
  146. #ifndef AZTEC_C
  147. struct _dev {
  148.     long  fd;
  149.     short mode;
  150.     };
  151. #endif
  152.  
  153. typedef struct hnode {
  154.     struct hnode *next, *prev;        /* doubly linked list */
  155.     char *line;                /* line in history    */
  156. } HIST;
  157.  
  158. typedef struct PErr {
  159.     int errnum;                /* Format of global error lookup */
  160.     char *errstr;
  161. } PERROR;
  162.  
  163. #ifdef MA_AMK
  164. #undef MA_AMK
  165. #endif
  166. /* #define MA_AMK 1 /* */
  167. typedef struct dirptr {                /* Format of directory fetch pointer */
  168.     BPTR lock;                /* lock on directory   */
  169.     FIB *fib;                /* mod'd fib for entry */
  170. #ifdef MA_AMK
  171.     struct DevProc *dvp;            /* for multi-assigns */
  172.     char *dname;                /* for multi-assigns */
  173. #endif
  174. } DPTR;
  175.  
  176. extern HIST *H_head, *H_tail;
  177. extern PERROR Perror[];
  178. extern char **av;
  179. extern char *Current;
  180. extern int  H_len, H_tail_base, H_stack, H_num;
  181. extern int  E_stack;
  182. extern int  Src_stack, If_stack, forward_goto;
  183. extern int  ac;
  184. extern int  max_ac;
  185. extern int  debug, Rval, Verbose, disable, Quit;
  186. extern int  Lastresult, atoierr;
  187. extern int  Exec_abortline;
  188. extern int  S_histlen;
  189. extern unsigned int options;
  190.  
  191. extern FILE *Src_base[MAXSRC];
  192. extern long  Src_pos[MAXSRC];
  193. extern short Src_if[MAXSRC], Src_abort[MAXSRC];
  194. extern char  If_base[MAXIF];
  195. extern struct Process *Myprocess;        /* The shell's process  */
  196. extern struct CommandLineInterface *Mycli;    /* Cli() */
  197. extern struct DosPacket *Mypacket;        /* initialization packet from AmigaDOS */
  198.  
  199. extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
  200.     v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
  201.     v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
  202.     v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
  203.     v_value[], v_nobreak[], v_bground[], v_pipe[], v_datefmt[], v_ioerr[],
  204.     v_abbrev[], v_rback[], v_insert[], v_failat[], v_clipri[],
  205.     v_dirformat[], v_nomatch[], v_prghash[], v_cquote[];
  206.  
  207. extern char o_hilite[], o_lolite[], o_rback[], *o_csh_qcd, o_internal;
  208. extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
  209. extern char o_nofastscr, o_nobreak, o_bground, o_resident, o_nomatch;
  210. extern char o_cquote;
  211. extern char o_pipe[], o_datefmt, o_abbrev, o_insert, *o_every;
  212. extern long o_noreq, o_failat;
  213. extern char Buf[], isalph[], confirmed, asked, *classfile;
  214.  
  215. extern char *MyMem;
  216.  
  217. #define isalphanum(x) isalph[x]
  218.  
  219. typedef struct file_info {
  220.     LONG flags;
  221.     LONG type;
  222.     LONG size;
  223.     LONG blocks;
  224.     char class[12];
  225.     struct DateStamp date;
  226. } FILEINFO;
  227.  
  228. typedef struct pattern {
  229.     int  casedep;
  230.     int  queryflag;
  231.     LONG patptr;
  232.     char pattern[1];
  233. } PATTERN;
  234.  
  235. #define INFO_COMMENT (1<<30)
  236. #define INFO_INFO    (1<<29)
  237.  
  238. typedef struct Class {
  239.     struct Class *next;
  240.     char name[1];
  241. } CLASS;
  242.  
  243. extern CLASS *CRoot, *LastCRoot;
  244. extern struct Window *Win;
  245.  
  246. extern long IoError;
  247.  
  248. typedef struct VNode {
  249.     struct VNode *next;
  250.     long len;
  251.     char *text;
  252.     char name[1];
  253. } NODE;
  254.  
  255. typedef struct VRoot {
  256.     NODE         *first[MAXHASH];
  257.     struct VRoot *parent;
  258. } ROOT;
  259.  
  260. struct PathList {
  261.     BPTR pl_NextPath;
  262.     BPTR pl_PathLock;
  263. };
  264.  
  265. /* internal programm path hash-list */
  266. extern char **prghash_list;
  267. extern long prghash_num;
  268.  
  269. #if 0
  270. LONG System( UBYTE *command, struct TagItem *tags );
  271. #ifdef AZTEC_C
  272. # pragma amicall(DOSBase, 0x25e, System(d1,d2))
  273. #endif
  274. #ifdef LATTICE
  275. # pragma libcall DOSBase System 25e 2102
  276. # pragma libcall DOSBase DoPkt F0 765432107
  277. #endif
  278. #endif
  279. #include "proto.h"
  280.  
  281.